package com.imooc.course6

/*
 * @Author Wangjin
 * @Date 2019-03-05
 * @Email wangjin4901@vip.qq.com
 */

object ArrayApp extends App {
//  val a = new Array[String](5)
//  a(1) = "hello"
//  val b = Array("Spark", "Hadoop", "Hive")
//  b(1)
//  val c = Array(1,2,3,4,5)
//  c.sum
//  c.max
//  c.min
//  c.mkString(":")

  val d = scala.collection.mutable.ArrayBuffer[Int]()
  d += 1
  d += 2
  d.append(3)
  d ++= Array(4,5,6)
  d.insert(0, 0)
  d.remove(2,2)
  d.trimStart(2)
  d.trimStart(1)
  d.toArray
  println(d)

  for (i <- d.indices) {
    println(d(i))
  }

  println("----")

  for (i <- d.reverse) {
    println(i)
  }


}
